package com.zhw.activiti.exception;

import com.zhw.activiti.constant.ResultEnum;
import com.zhw.activiti.utils.ResultVoUtil;
import com.zhw.activiti.vo.ResultVo;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author zhw
 */
@ControllerAdvice
public class SysExceptionHandler {

    @ResponseBody
    @ExceptionHandler(value = RuntimeException.class)
    public ResultVo handle(Exception e){
        return ResultVoUtil.error(ResultEnum.SYSTEM_ERROR.getCode(), e.getMessage());
    }

}
